<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<meta http-equiv="Cotent-Type" content="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../js/TC.js"></script>
<script type="text/javascript" src="grid.js"></script>
<link rel="STYLESHEET" type="text/css" href="grid.css">
</HEAD>

<BODY>
<textarea rows="5" cols="80" id="test"></textarea>
sss
<div id="dataGrid"
	style="width: 500px; height: 300px; position: relative; clear: both; padding: 1px;"></div>
</BODY>
<script type="text/javascript">
$(document).ready(function(){
	var data=genDataGrid();data.pageSize=10;data.currentPageNo=5;data.totalCount=100;
	var dataGrid=new $.DataGrid({el:'#dataGrid',data:data});
	dataGrid.show();
});
function genDataGrid(){
	var dataGrid={};
	var header=[];
	for(var i=0;i<33;i++){
		header.push({text:'基本工资基本工资基本工资'+i,name:'header'+i,width:'80'});
	}
	var data = [];
	for(var i=0;i<31;i++){
		var row={id:i};
		for(var j=0;j<10;j++){
			row['header'+j]='绩效工资绩效工资绩效工资'+i+'_'+j;
		}
		data.push(row);
	}
	dataGrid.header=header;
	dataGrid.data=data;
	return dataGrid;
}

function serializeJSON(o) {
	var objtype = typeof(o);
	if (objtype == "undefined") {
	return "null";
	} else if (objtype == "number" || objtype == "boolean") {
	return o + "";
	} else if (o === null) {
	return "null";
	}
	if (objtype == "string") {
	return reprString(o);
	}
	if(objtype == 'object' && o.getFullYear) {
	return reprDate(o);
	}
	var me = arguments.callee;
	if (objtype != "function" && typeof(o.length) == "number") {
	var res = [];
	for (var i = 0; i < o.length; i++) {
	  var val = me(o[i]);
	  if (typeof(val) != "string") {
	      val = "undefined";
	  }
	  res.push(val);
	}
	return "[" + res.join(",") + "]";
	}
	// it's a function with no adapter, bad
	if (objtype == "function")
	return null;
	res = [];
	for (var k in o) {
	var useKey;
	if (typeof(k) == "number") {
	  useKey = '"' + k + '"';
	} else if (typeof(k) == "string") {
	  useKey = reprString(k);
	} else {
	  // skip non-string or number keys
	  continue;
	}
	val = me(o[k]);
	if (typeof(val) != "string") {
	  // skip non-serializable values
	  continue;
	}
	res.push(useKey + ":" + val);
	}
	return "{" + res.join(",") + "}";
}
function reprString(o) {
	return ('"' + o.replace(/(["\\])/g, '\\$1') + '"'
	).replace(/[\f]/g, "\\f"
	).replace(/[\b]/g, "\\b"
	).replace(/[\n]/g, "\\n"
	).replace(/[\t]/g, "\\t"
	).replace(/[\r]/g, "\\r");
}

function reprDate(db) {
	var year = db.getFullYear();
	var dd = db.getDate();
	var mm = db.getMonth()+1;
	
	var hh = db.getHours();
	var mins = db.getMinutes();
	
	function leadingZero(nr) {
	if (nr < 10) nr = "0" + nr;
	return nr;
	}
	if(hh == 24) hh = '00';
	
	var time = leadingZero(hh) + ':' + leadingZero(mins);
	return '"' + year + '-' + mm + '-' + dd + 'T' + time + '"';
}
</script>
</HTML>
